package com.sakhalin.news.models.news

import com.google.gson.annotations.SerializedName
import com.sakhalin.news.models.ItemType


/**
 * Класс описывающий элемент списка новостей
 */
data class NewsItem(
    @SerializedName("item_type")
    var _type: ItemType?,
    @SerializedName("id")
    val id: String,
    @SerializedName("date")
    val date: String,
    @SerializedName("time")
    val time: String,
    @SerializedName("label_date")
    val labelDate: String,
    @SerializedName("title")
    val title: String?,
    @SerializedName("description")
    val text: String?,
    @SerializedName("important")
    val important: Int,
    @SerializedName("views_count")
    val viewsCount: Int,
    @SerializedName("comments_count")
    val commentsCount: Int,
    @SerializedName("image")
    val imageUrl: String?,
    @SerializedName("source")
    val source: String,
) {
    val type: ItemType
        get() = _type ?: ItemType.Item
}
